package com.minimalist.common.feign.fallback.lindi;

import com.minimalist.common.entity.lindi.vo.subsidyapplicationtownpayment.LindiSubsidyApplicationTownPaymentVO;
import com.minimalist.common.feign.client.lindi.LindiSubsidyApplicationTownPaymentFeignClient;
import com.minimalist.common.feign.config.BaseFallbackFactory;
import com.minimalist.common.response.R;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * 林地指标平台_镇街支付明细Feign客户端降级工厂
 *
 * @author 11987
 */
@Component
public class LindiSubsidyApplicationTownPaymentFeignClientFallbackFactory extends BaseFallbackFactory<LindiSubsidyApplicationTownPaymentFeignClient>{

    private static final Logger log = LoggerFactory.getLogger(LindiSubsidyApplicationTownPaymentFeignClientFallbackFactory.class);

    @Override
    public LindiSubsidyApplicationTownPaymentFeignClient create(Throwable cause){
        return new LindiSubsidyApplicationTownPaymentFeignClient(){

            @Override
            public R<?> addSubsidyApplicationTownPayment(LindiSubsidyApplicationTownPaymentVO subsidyApplicationTownPaymentVO){
                logServiceUnavailable("添加镇街支付明细", subsidyApplicationTownPaymentVO, cause);
                return R.fail(HttpStatus.SERVICE_UNAVAILABLE.value(), "添加镇街支付明细服务不可用，原因：" + cause.getMessage());
            }

            @Override
            public R<?> deleteSubsidyApplicationTownPaymentBySubsidyApplicationTownPaymentId(Long subsidyApplicationTownPaymentId){
                logServiceUnavailable("删除镇街支付明细", subsidyApplicationTownPaymentId, cause);
                return R.fail(HttpStatus.SERVICE_UNAVAILABLE.value(), "删除镇街支付明细服务不可用，原因：" + cause.getMessage());
            }

            @Override
            public R<?> updateSubsidyApplicationTownPaymentBySubsidyApplicationTownPaymentId(LindiSubsidyApplicationTownPaymentVO subsidyApplicationTownPaymentVO){
                logServiceUnavailable("修改镇街支付明细", subsidyApplicationTownPaymentVO, cause);
                return R.fail(HttpStatus.SERVICE_UNAVAILABLE.value(), "修改镇街支付明细服务不可用，原因：" + cause.getMessage());
            }

            @Override
            public R<LindiSubsidyApplicationTownPaymentVO> getSubsidyApplicationTownPaymentBySubsidyApplicationTownPaymentId(Long subsidyApplicationTownPaymentId){
                logServiceUnavailable("查询镇街支付明细", subsidyApplicationTownPaymentId, cause);
                return R.fail(HttpStatus.SERVICE_UNAVAILABLE.value(), "查询镇街支付明细服务不可用，原因：" + cause.getMessage());
            }

            @Override
            public R<List<LindiSubsidyApplicationTownPaymentVO>> getSubsidyApplicationTownPaymentListBySubsidyApplicationPayNoticeId(Long subsidyApplicationPayNoticeId){
                logServiceUnavailable("查询镇街支付明细列表", subsidyApplicationPayNoticeId, cause);
                return R.fail(HttpStatus.SERVICE_UNAVAILABLE.value(), "查询镇街支付明细列表服务不可用，原因：" + cause.getMessage());
            }
        };
    }
}